Function Reference

_MathCheckDiv

Checks if NumA is divisable by NumB

#include <Math.au3>
_MathCheckDiv ( $i_NumA, $i_NumB )

 

Parameters

$i_NumA Number to check
$i_NumB Number to divide by

 

Return Value

Success: Returns 1 for not divisable,
2 for divisable.
Failure: Returns -1 and @error = 1 if not valid numbers.

 

Remarks

This function will also enable checking if a number is even/odd by making the second parameter = 2

 

Related

None.

 

Example


#include <math.au3>
$I_Var = InputBox('Odd or Even', 'Enter a number:')
$I_Result = _MathCheckDiv($I_Var, 2)
If $I_Result = -1 Or @error = 1 Then
   MsgBox(0,'','You did not enter a valid number')
ElseIf $I_Result = 1 Then
   MsgBox(0,'','Number is odd')
ElseIf $I_Result = 2 Then
   MsgBox(0,'','Number is even')
Else
   MsgBox(0,'','Could not parse $I_Result')
EndIf